<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>03_bindings | KnockOut.js</title>
  <script src="../assets/knockout-3.5.1.js"></script>
</head>
<body>

  <!-- 展示 text -->
  <p>Message is: <span data-bind="text: msg"></span></p>

  <!-- 展示 html -->
  <p>Message is: <span data-bind="html: msg"></span></p>

  <script type="text/javascript">   
    var vm = {      
      msg: ko.observable('Hello, world!'), // 初始化
    };

    vm.msg('<i>Hello, world!</i>')

    // 激活 KnockOut
    ko.applyBindings(vm);
  </script> 
    
</body>
</html>